<?php
require_once 'application/library/db/gcBBasicDao.php';
require_once 'application/library/db/gcDbTransaction.php';

/** 
 * 事务操作用类
 * gcTBasicDao
 * @author    Soochow University
 * @version   1.0
 * @exclude   作  成  日：2011/04/07
 */
class gcTBasicDao extends gcBBasicDao{
    
    /**
     * Transaction
     */
    private $Transaction;
    
    /**
     * __construct
     */
    public function __construct(){
        parent::__construct();
        $this->Transaction= new gcDbTransaction();
    }
    
    /**
     * 事务数据取得
     * Select_T
     * @param   string  $sql 
     * @param   array   $parameter
     * @param   string  $type
     * @return  string  $select
     */
    public function Select_T($sql,$parameter,$type){
        $select = $this->Transaction->Select_T($sql, $parameter,$type);
        return $select;
    }
    
    /**
     * 事务数据登录
     * Insert_T
     * @param   string  $sql 
     * @param   array   $parameter
     * @return  string  $insert
     */
    public function Insert_T($sql,$parameter){
        $insert = $this->Transaction->Insert_T($sql, $parameter);
        return $insert;
    }
    
    /**
     * 事务数据批量登录
     * batchInsert_T
     * @param   string  $sql 
     * @param   array   $parameter
     * @return  string  $count
     */
    public function batchInsert_T($sql,$arrParameter) {
        $count = $this->Transaction->batchInsert_T($sql,$arrParameter);
        return $count;
    }
    
    /**
     * 事务数据更新
     * Update_T
     * @param   string  $sql 
     * @param   array   $parameter
     * @return  string  $count
     */
    public function Update_T($sql,$parameter){
        $count = $this->Transaction->Update_T($sql, $parameter);
        return $count;
    }
    
    /**
     * 事务数据消除
     * Delete_T
     * @param   string  $sql 
     * @param   array  $parameter
     * @return  
     */
    public function Delete_T($sql,$parameter){
        $count = $this->Transaction->Delete_T($sql, $parameter);
        return $count;
    }
    
    /**
     * 事务开始
     * beginTransaction
     * @return  obj     $transaction
     */
    public function beginTransaction(){
        $transaction = $this->Transaction->beginTransaction();
        return $transaction;
    }
    
    /**
     * 事务提交
     * commit
     */
    public function commit(){
        $this->Transaction->commit();
    }
    
    /**
     * 事务回滚
     * rollBack
     */
    public function rollBack(){
        $this->Transaction->rollBack();
    }
    
    /**
     * 设定事务
     * setTransaction
     * @param   obj     $db
     */
    public function setTransaction($db){
        $this->Transaction->setTransaction($db);
    }
}